home *** CD-ROM | disk | FTP | other *** search
- Path: in1.uu.net!novia!oasis!nicatt
- From: nicatt@oasis.novia.net (Nicatt)
- Newsgroups: comp.lang.c
- Subject: Re: Easy but puzzling
- Date: 2 Jan 1996 23:37:05 GMT
- Organization: Novia Internetworking.
- Message-ID: <4ccfj1$mm1@nntp.novia.net>
- References: <4c4uej$a86@nntp.novia.net>
- NNTP-Posting-Host: oasis.novia.net
- X-Newsreader: TIN [version 1.2 PL2]
-
- Nicatt (nicatt@oasis.novia.net) wrote:
-
- Thank you for the responses. I have an answer. Basically, I have to
- catch the return from the function, evaluate it, clear the buffer
- and prompt user again for a valid entry.
-
- : I am new to the world of C and know I am overlooking something easy.
- : The last 6 hours have put me in a disagreeable mood. Here is the
- : situation this rookie is in:
-
- : I am requesting input from the user four times in a function. In the
- : first two scanf's, the user must enter a numeric value from -1000 to
- : +1000. The third scanf is a single digit numeric value and the fourth
- : scanf is an alpha character.
-
- : Since the first three cannot be alpha characters I need to error trap alpha
- : entries. I cannot get the first trap to work except for numeric values
- : outside the range. How do I loop back to the scanf (to permit retries)
- : when the user enters alpha characters. In essence, how do I trap them?
-
- : I have worked "while" loops until I am blue in the face and I can not get
- : it to work. I can trap the alpha character in the fourth scanf easily
- : since the options are only the 'f' or 'c' character. And, as mentioned
- : above, I can trap numeric values outside the permitted range.
-
- : Feel free to e-mail.
-
- : Nicatt
-
-
-